﻿/// <summary>
/// Windows Form to alterate values of RGB Gama 
/// </summary>

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _6055_9989_LP_Photoshop_2012_2013
{
    /// <summary>
    /// Sets the start values and the place in the mais window
    /// </summary>
    /// <value>min is the minimum value of the trackbar </value>
    /// <value>max is the maximum value of the trackbar </value>
    /// <value>inicials values where the trackbar will start </value>
    /// <value>values of red </value>
    /// <value>values of green </value>
    /// <value>values of blue </value>
    /// <remarks>All the values must be numeric.
    /// </remarks>
    public partial class GamaForm : Form
    {
        private int min = 20;
        private int max = 500;
        private int initial = 20;
        public double red { set; get; }
        public double green { set;  get; }
        public double blue { set;  get; }

        public GamaForm()
        {
            InitializeComponent();
            
            this.tBarRed.Maximum = this.max;
            this.tBarRed.Minimum = this.min;
            this.tBarRed.Value = this.initial;
            
            this.tBarGreen.Maximum = this.max;
            this.tBarGreen.Minimum = this.min;
            this.tBarGreen.Value = this.initial;
            
            this.tBarBlue.Maximum = this.max;
            this.tBarBlue.Minimum = this.min;
            this.tBarBlue.Value = this.initial;
            
            this.red = (double)this.initial/100;
            this.green = (double)this.initial / 100;
            this.blue = (double)this.initial / 100;
            OK.DialogResult = System.Windows.Forms.DialogResult.OK;
            Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
        }

        private void tBarBlue_Scroll(object sender, EventArgs e)
        {
            this.lblValueBlue.Text = ((double)this.tBarBlue.Value / 100).ToString();
            this.red = ((double)this.tBarRed.Value / 100);
        }

        private void tBarGreen_Scroll(object sender, EventArgs e)
        {
            this.lblValueGreen.Text = ((double)this.tBarGreen.Value / 100).ToString();
            this.green = ((double)this.tBarGreen.Value / 100);
        }

        private void tBarRed_Scroll(object sender, EventArgs e)
        {
            this.lblValueRed.Text = ((double)this.tBarRed.Value/100).ToString();
            this.blue = (double)this.tBarBlue.Value / 100;
        }

       
    }
}
